package com.xiyou.weblog.web.controller;

import com.xiyou.weblog.common.aspect.ApiOperationLog;
import com.xiyou.weblog.common.utils.Response;
import com.xiyou.weblog.web.model.vo.tag.FindTagArticlePageListReqVO;
import com.xiyou.weblog.web.service.TagService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/tag")
@Tag(name = "标签")
public class TagController {

    @Resource
    private TagService tagService;


    @PostMapping("/list")
    @ApiOperationLog(description = "前台获取标签列表")
    @Operation(summary = "前台获取标签列表")
    public Response findTagList() {
        return tagService.findTagList();
    }

    @PostMapping("/article/list")
    @ApiOperationLog(description = "前台获取标签下文章列表")
    @Operation(summary = "前台获取标签下文章列表")
    public Response findTagPageList(@RequestBody @Validated FindTagArticlePageListReqVO findTagArticlePageListReqVO) {
        return tagService.findTagPageList(findTagArticlePageListReqVO);
    }
}
